﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebMassage.Models.KTVDetailViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Xem chi tiết thông tin Kỹ thuật viên
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%= Url.Content("~/Scripts/jquery-1.4.1.js") %>" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        var i = 1;
        function GetPages() {
            $.get($(this).attr("href"), function (response) {
                $("#pages").replaceWith($("#pages", response));
            });
            return false;
        }

        $(function () {
            $("#lnkMoreUpload").live("click", function () {
                $("#divFiles").append('<div style="padding:4px;"><a href="#"  class="aRemoveFile">Xóa</a> <input type="file" name="file' + i + '' + '" /></div>');
                i = i + 1;
            });

            $(".aRemoveFile").live("click", function () {
                var child = $(".aRemoveFile").parent()[0];
                var parent = $(".aRemoveFile").parent().parent()[0];
                parent.removeChild(child);
                //$(".aRemoveFile").parent()[0].innerHTML = "";
                return false;
            });

            $(".aRemovePic").live("click", function () {
                var id = $(this).attr('id');
                var divPic = document.getElementById('divPic' + id);
                var parent = divPic.parentNode;
                parent.removeChild(divPic);

                $.get('/KTV/DeleteKTVPic/' + id, function (response) {
                    alert(response.toString());
                });
                //alert(id);
                return false;
            });
        });
    </script>
    <div style="padding: 10px">
        <h2>
            Chỉnh sửa thông tin kỹ thuật viên</h2>
        <br />
        <fieldset style="padding: 10px">
            <div id="sliderPics">
                <% using (Html.BeginForm("UploadImage", "KTV", FormMethod.Post, new { enctype = "multipart/form-data" }))
                   {%>
                <div style="display: none">
                    <input type="text" name="KTVNum" value="<%= Model.KTV.KTVNum %>" />
                </div>
                <div id="divFiles">
                    <div style="padding: 4px;">
                        <a href="#" class="aRemoveFile">Xóa</a>
                        <input type="file" name="file" id="fileUpload" />
                    </div>
                </div>
                <div style="padding: 5px">
                    <input type="submit" value="Upload file" />
                </div>
                <% } %>
            </div>
            <div>
                <img id="lnkMoreUpload" class="more" src="/Content/Images/Black/MORE.png" alt="" /></div>
            <legend style="color: White">Thông tin kỹ thuật viên</legend>
            <div style="width: 100%; clear:both;">
                <div style="width: 50%; float: left">
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px;">
                            Mã nhân viên:
                        </div>
                        <div class="input-field">
                            <%= Model.KTV.KTVNum %></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Họ tên:
                        </div>
                        <div class="input-field">
                            <%= Model.KTV.Name%></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Ngày sinh:
                        </div>
                        <div class="input-field">
                            <%= string.Format("{0:dd/MM/yyyy}", Model.KTV.BirthDate)%></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Giới tính:
                        </div>
                        <div class="input-field">
                            <%= Model.KTV.Sex ? "Nam" : "Nữ"%></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Vòng 1:</div>
                        <div class="input-field">
                            <%= Model.KTV.Size1%></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Vòng 2:</div>
                        <div class="input-field">
                            <%= Model.KTV.Size2%></div>
                    </div>
                </div>
                <div style="width: 50%; float: left">
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Vòng 3:</div>
                        <div class="input-field">
                            <%= Model.KTV.Size3%></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Chiều cao:</div>
                        <div class="input-field">
                            <%= Model.KTV.Height%>
                            cm</div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Cân nặng:</div>
                        <div class="input-field">
                            <%= Model.KTV.Weight%>
                            kg</div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Ghi chú:
                        </div>
                        <div class="input-field">
                            <%= Model.KTV.Note%></div>
                    </div>
                    <div class="editor-label">
                        <div class="label-field" style="width: 100px">
                            Hiển thị ra trang chủ:</div>
                        <div class="input-field">
                            <%= Html.CheckBoxFor(model => model.KTV.ShowInHome.Value)%></div>
                    </div>
                </div>
            </div>
            <div style="width: 100%;clear: both;" id="divPics">
                <% foreach (var item in Model.Pics)
                   { %>
                <div style="float: left; border: 1px solid white" id="divPic<%= item.PID %>">
                    <div>
                        <img src="<%= item.PictureUrl %>" class="ktv" alt="<%= item.Note %>" width="70px"
                            height="70px" />
                    </div>
                    <div style="text-align: center">
                        <a href="#" class="aRemovePic" id="<%=item.PID %>">Xóa</a>
                    </div>
                </div>
                <% } %>
            </div>
        </fieldset>
        <div style="padding-top: 10px">
            <%= Html.ActionLink("Trở lại danh sách", "Manager") %>
        </div>
    </div>
</asp:Content>
